package com.hutianao.gqgl.information.electric.service.impl;

import com.hutianao.gqgl.information.electric.entity.SearchElectricEntity;
import com.hutianao.gqgl.information.electric.respository.ElectricDao;
import com.hutianao.gqgl.information.electric.service.ElectricService;
import com.hutianao.gqgl.mybatis.entity.ElectricEntity;
import com.hutianao.gqgl.mybatis.flexigrid.PaddingEntity;
import com.hutianao.gqgl.mybatis.flexigrid.PadingRstType;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


@Service
public class ElectricServiceImpl implements ElectricService {
    @Resource
    private ElectricDao electricDao;

    @Override
    public PadingRstType<ElectricEntity> queryElectricInfoListByPage(SearchElectricEntity search, PaddingEntity padding) {
        padding.deal(ElectricEntity.class);
        PadingRstType<ElectricEntity> padingRstType = new PadingRstType<>();
        padingRstType.setPage(padding.getPage());
        List<ElectricEntity> list = electricDao.queryElectricInfoListByPage(search,padding);
        padingRstType.setRawRecords(list);
        Integer total = electricDao.queryElectricInfoTotal(search);
        padingRstType.setTotal(total);
        padingRstType.putItems();

        return padingRstType;
    }
}
